import request from '@/config/axios'

export interface DataSourceConfigVO {
  id?: number
  name: string
  url: string
  username: string
  password: string
  createTime?: string
}

export const getDataSourceConfigList = async () => {
  return await request.get({ url: '/infra/data-source-config/list' })
}

export const getDataSourceConfig = async (id: number) => {
  return await request.get({ url: '/infra/data-source-config/get', params: { id } })
}

export const createDataSourceConfig = async (data: DataSourceConfigVO) => {
  return await request.post({ url: '/infra/data-source-config/create', data: data })
}

export const updateDataSourceConfig = async (data: DataSourceConfigVO) => {
  return await request.post({ url: '/infra/data-source-config/update', data: data })
}

export const deleteDataSourceConfig = async (id: number) => {
  return await request.delete({ url: '/infra/data-source-config/delete', params: { id } })
}
